package com.ly.video.api.user.mapper;

import com.ly.video.api.user.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper {


    /**
     * 通过OPENID查询用户
     * @return
     */
    public UserEntity findUserByOpenid(String openid);

    /**
     * 通过OPENID注册用户
     * @param openid
     * @return
     */
    public Integer regUserByOpenid(String openid);

    /**
     * 修改用户上级UID
     */
    public Integer updateUserFatherUid(UserEntity user);

    /**
     * 通过UID查找用户
     */
    public UserEntity findUserByUid(String uid);

    /**
     * 修改用户金币及权重
     */
    public Integer updateUserCoinWeight(UserEntity user);

    /**
     * 修改用户金币
     */
    public Integer updateUserCoin(UserEntity user);

    /**
     * 修改用户权重
     */
    public Integer updateUserWeight(UserEntity user);

    /**
     * 查询用户下级信息
     */
    public List<UserEntity> findUserSons(@Param("page") int page, @Param("size")int size, @Param("uid") String uid);
}
